    //
//  RS2ViewController.m
//  SmartRoadShow
//
//  Created by simon on 10-9-17.
//  Copyright 2010 simonwang142232@gmail.com. All rights reserved.
//

#import "RS2ViewController.h"
#import "SendHttpRequest.h"
#import "MyDataSource.h"
#import "ArtTour.h"
#import "MyPhotoView.h"
#import <QuartzCore/QuartzCore.h>

@implementation RS2ViewController


- (void)viewDidLoad {
    [super viewDidLoad];
	self.view.backgroundColor = [UIColor colorWithRed:0.79 green:0.78 blue:0.78 alpha:1.0];
	
	
	frist = YES;
	
	
	webView = [[UIWebView alloc] initWithFrame:CGRectMake(5, 5, 310, 336)];
	[webView setBackgroundColor:[UIColor whiteColor]];
	webView.layer.cornerRadius = 8;
	webView.layer.masksToBounds = YES;
	webView.dataDetectorTypes = UIDataDetectorTypeNone;
	[webView setDelegate:self];
//	[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://wap.moad.cn/MOAD/10236/y.aspx"]]];
	[self.view addSubview:webView];
	
	waitView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
	[waitView setCenter:webView.center];
	[waitView setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleGray];
	[waitView setHidesWhenStopped:YES];
	[webView addSubview:waitView];
}

- (void)viewDidShow{
	if (frist) {
		[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:kBuyCarOnline]]];
        frist = NO;
	}
}

- (void)webViewDidStartLoad:(UIWebView *)webView{
	[waitView startAnimating];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView{
	[waitView stopAnimating];
	
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{
	frist = YES;
	[waitView stopAnimating];
	UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"本功能需要网络支持，请检查网络连接！"
												   delegate:nil
										  cancelButtonTitle:@"确定"
										  otherButtonTitles:nil];
	[alert show];
	[alert release];
}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Overriden to allow any orientation.
    return YES;
}


- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}


- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end
